import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import set_node_cls from "@dfeidao/atom-web/ui/set-node-cls";
import nodejs from '@dfeidao/atom-web/msg/nodejs';

import fire from '@dfeidao/atom-web/msg/fire';

export default async function a007(fd: IFeidaoAiBrowserComponent) {
	// todo

	// const no1 = get(fd, 'id1') as string;
	const no2 = get(fd, 'id2') as string;

	console.log("IDDIDID666", no2);

	if (!no2) {
		const no = get(fd, 'id1') as string;
		console.log("IDDIDID", no);
		fire('zj-000008', 'a001', '4', no);

	} else {
		const res = await nodejs<{ code: 0 | 1; result: string; }>('risk_point/zj-000004/s004', {
			filter: {
				hidden_source: no2
			}
		});
		// if (res.code === 1) {
		// 	alert('删除成功');
		// 	window.location.reload();
		// } else {
		// 	alert('删除失败');
		// }

		const no = get(fd, 'id1') as string;
		console.log("IDDIDID", no);
		fire('zj-000008', 'a001', '4', no);

	}

	// console.log("IDDIDID", no1);


	// const no = { no1, no2 };

	// console.log("IDDIDID88888", no);

	// const no = get(fd, 'id1') as string;
	// console.log("IDDIDID", no);
	// fire('zj-000008', 'a001', '4', no);

	const p3 = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p003"]');
	set_node_cls(p3, 'display-n', true);
}
